from datetime import datetime
from sqlmodel import Field

from pydantic import BaseModel
from timescaledb import TimescaleModel

from model.evaluate import Evaluate

"""
交易记录
"""
class TradeHistory(BaseModel):
    orderID: str # 订单ID
    date_time: datetime # 日期时间
    price: float # 单价
    signal: int # 买卖信号
    profit_cash: float # 盈亏 即买入多少 卖出多少
    cash: float # 资金
    new_position: float # 仓位变化
    total_position: float # 总仓位
    # 其他评估指标

"""
订单记录
"""
class OrderHistory(BaseModel):
    orderID: str # 订单ID
    code: str # 股票代码
    date_time: datetime # 日期时间
    strategy_name: str # 策略名称
    evaluate: Evaluate